package org.peoplesearch.vk.executor;

import com.perm.kate.api.Auth;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Collection;

public class AccessTokenGenerator {

    private Collection<String> appIds;

    public AccessTokenGenerator(Collection<String> AppIds) {
        this.appIds = AppIds;
    }

    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext(
                "executor.xml");
        AccessTokenGenerator accessTokenGenerator = (AccessTokenGenerator)
                ctx.getBean("accessTokenGenerator");
        for (String appId : accessTokenGenerator.appIds) {
            String url = Auth.getUrl(appId, Auth.getSettings());
            System.out.println(url);
        }
    }

}
